<?php
/*
 * akimimi front
 * User Info Index page
 * 
 * author steve
 */
require_once '../app/views/BaseView.php';

class UserIndexView extends BaseView {
	public function getPage($userInfo,$agentAccountInfo=array()){
		$this->setPageTitle(constant("PERSONALINFO"));
		$this->addJS('frontend.js',true);
		$this->addCSS('myaccountleftnav.css');
		$this->addCSS('myaccount.css');
		$header = '';
		$str_result = $header
                    . $this->getContent($userInfo,$agentAccountInfo);
        return $this->getHtmlPage($str_result);
	}
	
	public function getContent($userInfo,$agentAccountInfo){
		$str_result = '<div id="navigation"><a href="/">'.WEBSITEINDEXPAGETXT.'</a><span>></span><a href="/userinfo/index">'.MYAKIMIMITXT.'</a></div>';
		$str_result .= '<div id="mymimi_body">'.MyAccountLeftNav::getMyAccountLeftNav();
	    $str_result .= '<div id="mymimi_right"><div class="right_bj"></div>';
	    $str_result .= '<div class="add_border" >';
	    $str_result .= '<div class="add_row_1" style="margin-top:10px; padding:0px; "><ul>';
	    $str_result .= '<li style="color:#ff0000;font-size:14px;">'.$_SESSION['username'].'</li><li style="font-size:14px;" >'.NINHAO.'</li>';
	    $str_result .= '</ul></div>';
	    
	    $str_result .= '<div class="add_row_1" style="padding: 0px;" ><ul>';
	    $str_result .= '<li style="font-size:14px;">'.LASTLOGIN.' '.$userInfo[0]['last_login'].'</li><li ></li>';
	    $str_result .= '</ul></div>';
	    $identy = '';
	    $showInfo = '';
	    switch($userInfo[0]['certf']){
                      	        case 1:
                      	        	if($userInfo[0]['campus_id'] > 0){
                      	        		$identy = CERTF7;
                      	        	} else {
                      	                $identy = CERTF1;
                      	        	}
                      	            $showInfo = APPLYCAMPUSAGENCY;
                      	            if(AAService::isLogin() && AAService::isActive()){
                      	                $skipUrl = "UtilFunction.gotoUrl('/u/campusapply')";
                      	            }else{
                      	                $skipUrl = "alert('请先激活账号')";
                      	            }
                      	            break;
                      	        case 3 :
                      	        	$identy = CERTF3;
                      	        	break;
                      	        case 4 :
                      	        	$identy = CERTF4;
                      	        	break;
                      	        case 5 :
                      	        	$identy = CERTF5;
                      	        	break;
                      	        case 6 :
                      	        	$identy = CERTF6;
                      	        	break;
                      	       
                      } 
                   
	    $str_result .= '<div class="add_row_1" style="padding: 0px;" ><ul>';
	    $str_result .= '<li style="font-size:14px;">'.IDENTITYINFO.'</li>';
	    $str_result .= '<li style="font-size:14px;" >'.$identy.'</li>';
	    $str_result .= '<li  style="font-size:14px; color:#0000FF;text-decoration:underline;"><span style="cursor:pointer;" onclick="('.$skipUrl.')">'.$showInfo.'</span></li>';
	    $str_result .= '</ul></div>';
	    
	    if($userInfo[0]['certf']==3 && !empty($agentAccountInfo)){
	    	$str_result .= '<div class="add_row_1" style="padding: 0px;" ><ul>';
	        $str_result .= '<li style="font-size:14px;">'.ACCOUNTBALANCE.COLON.'</li>';
	        $str_result .= '<li style="font-size:14px;" >'.$agentAccountInfo['balance'].'</li>';
	        $str_result .= '</ul></div>';
	        
	        $str_result .= '<div class="add_row_1" style="padding: 0px;" ><ul>';
	        $str_result .= '<li style="font-size:14px;">'.DEBTTOTAL.COLON.'</li>';
	        $str_result .= '<li style="font-size:14px;" >'.$agentAccountInfo['debt_total'].'</li>';
	        $str_result .= '</ul></div>';
	        
	        $str_result .= '<div class="add_row_1" style="padding: 0px;" ><ul>';
	        $str_result .= '<li style="font-size:14px;">'.DEBTBALANCE.COLON.'</li>';
	        $str_result .= '<li style="font-size:14px;" >'.$agentAccountInfo['debt_balance'].'</li>';
	        $str_result .= '</ul></div>';
	        
	        $str_result .= '<div class="add_row_1" style="padding: 0px;" ><ul>';
	        $str_result .= '<li style="font-size:14px;">'.USAGEBALANCE.COLON.'</li>';
	        $str_result .= '<li style="font-size:14px;" >'.$agentAccountInfo['usage_balance'].'</li>';
	        $str_result .= '</ul></div>';
	        
	        $str_result .= '<div class="add_row_1" style="padding: 0px;" ><ul>';
	        $str_result .= '<li style="font-size:14px;">'.FREEZEDBALANCE.COLON.'</li>';
	        $str_result .= '<li style="font-size:14px;" >'.$agentAccountInfo['freezed_balance'].'</li>';
	        $str_result .= '</ul></div>';
	    	
	    }
	    if(!AAService::isActive()){
	    	$attention = ATTENTION;
	    	$promptActiveInfo = PROMPTUSERACTIVEACCOUNTINFO;
	    	$activeImmediately = ACTIVEIMMIDIATELY;
	    	
	    $str_result .=
<<<str_active
            <div class="add_row_1" style="padding: 0px; margin:10px 0 0 10px;" >
                <span style="color:#ff0000">{$attention}：</span>
                <span style="color:#ff0000" >{$promptActiveInfo}</span>
                <span style="color:#0000ff; cursor:pointer;" onclick="javascript:Active.activeAccount();" >{$activeImmediately}</span>
            </div>
str_active;
	    }
	    $str_result .= '</div></div></div';
	    
	    return $str_result;
	    
	    
	}
}
